/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.flexengine.logger;

import java.io.Serializable;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author Luann R. Athayde
 * @version 1.0
 * @since 1.0
 */
public class DataLogger implements Serializable {

    private int          id;
    private LoggerType   type;
    private StringBuffer msg;
    private Date         date;

    private DataLogger   ant;
    private DataLogger   prox;
    
    private DateFormat   df;

    public DataLogger() {
        this(0,null,null,null);
    }

    public DataLogger(LoggerType type, StringBuffer msg, Date date) {
        this(0,type, msg, date);
    }
    public DataLogger(int id, LoggerType type, StringBuffer msg, Date date) {
        this.id = id;
        this.type = type;
        this.msg = msg;
        this.date = date;
        this.ant = null;
        this.prox = null;
        this.df = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public StringBuffer getMsg() {
        return msg;
    }

    public void setMsg(StringBuffer msg) {
        this.msg = msg;
    }

    public LoggerType getType() {
        return type;
    }

    public void setType(LoggerType type) {
        this.type = type;
    }

    public DataLogger getAnt() {
        return ant;
    }

    public DataLogger getProx() {
        return prox;
    }

    public void setAnt(DataLogger ant) {
        this.ant = ant;
    }

    public void setProx(DataLogger prox) {
        this.prox = prox;
    }
    
    public void setDateFormat(String pattern) {
        df = new SimpleDateFormat(pattern);
    }

    @Override
    public String toString() {
        return "["+id+" "+type+"] - "+df.format(date) +" | "+msg;
    }

}